package health.lm.com.mine.present;

import com.scwang.smartrefresh.layout.SmartRefreshLayout;

import health.lm.com.component_base.base.mvp.contract.XPresent;
import health.lm.com.mine.activity.RecordListActivity;
import health.lm.com.mine.entity.RecordListBean;
import health.lm.com.mine.model.MineModel;
import health.lm.com.network.callback.SimpleCallBack;
import health.lm.com.network.exception.ApiException;

/**
 * 提现明细
 */

public class RecordListPresenter extends XPresent<RecordListActivity> {


    public void getDealList(boolean isRefresh, Object layout,int page, int pageSize) {

        MineModel.getInstance().recordList(page, pageSize, new SimpleCallBack<RecordListBean>() {
            @Override
            public void onSuccess(RecordListBean dealListBean) {
                if (hasV()) {
                    getV().getDealListSuccess(dealListBean.getList());
                }
                if(isRefresh){
                    ((SmartRefreshLayout)layout).finishRefresh(true);
                }
            }

            @Override
            public void onError(ApiException e) {
                super.onError(e);
                if(isRefresh){
                    ((SmartRefreshLayout)layout).finishRefresh(true);
                }
            }
        });
    }
}
